﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="admin_Login.aspx.cs" Inherits="admin_Login" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Admin_Login</title>
<link type="text/css" rel="stylesheet" href="css/common.css" />
<link type="text/css" rel="stylesheet" href="css/admin.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<!--Enter完成提交S-->
<script type="text/javascript">
    function OnText1Key(e) {
        e = e || event;
        if (e.keyCode == 13) {
            document.getElementById("LinkButton1").focus();
            var a = document.getElementById("LinkButton1");
            invokeClick(a);
        }
    }
</script>
<!--Enter完成提交E-->

<script type="text/javascript">

    function validate() {
        checkAccount();
        checkPassword();
        checkCode();
    }

    function checkAccount() {
        var errMessage = document.getElementById("<%=Label_errrMessage.ClientID %>"); 
        var accountTex = document.getElementById("<%=tb_Email.ClientID %>");
        var accountMessage = document.getElementById("<%=Label_accountMessage.ClientID %>");
        if (accountTex.value == "") {
            accountMessage.innerHTML = "Account is required";
        } else {
            accountMessage.innerHTML = "";
        }
        errMessage.innerHTML = "";
    }

    function checkPassword() {
        var errMessage = document.getElementById("<%=Label_errrMessage.ClientID %>"); 
        var passwordTex = document.getElementById("<%=tb_Password.ClientID %>");
        var passwordMessage = document.getElementById("<%=Label_passwordMessage.ClientID %>");
        if (passwordTex.value == "") {
            passwordMessage.innerHTML = "Password is required";
        } else {
            passwordMessage.innerHTML = "";
        }
        errMessage.innerHTML = "";
    }

    function checkCode() {
        var checkTex = document.getElementById("<%=tb_validateCode.ClientID %>");
        var errMessage = document.getElementById("<%=Label_chechCodeMessage.ClientID %>");

        $.get("Handlers/CheckCodeHandler.ashx", { action: "check", iputCheckCode: checkTex.value },
        function(data) {
            if (data == "true") {
                var errMessage = document.getElementById("<%=Label_chechCodeMessage.ClientID %>");
                if (errMessage.innerHTML == "Check code error") {
                    errMessage.innerHTML = "";
                }
                return true;
            } else {
                var errMessage = document.getElementById("<%=Label_chechCodeMessage.ClientID %>");
                errMessage.innerHTML = "Check code error";
                document.getElementById("span_info").style.display = "none";
                return false;
            }
        }
        );

    }


    function updateCheckCode() {
        setTimeout(function() {
            document.getElementById("Image_Validate").src = "Handlers/CheckCodeHandler.ashx?action=getImage&id=" + Math.random();
        }, 100);
    }

    function invokeClick(element) {
        if (element.click) element.click();
            else if (element.fireEvent) element.fireEvent('onclick');
            else if (document.createEvent) {
                var evt = document.createEvent("MouseEvents"); evt.initEvent("click", true, true);
                element.dispatchEvent(evt);
            } 
    }

function presskey(e) {

    var keynum
    var keychar
    var numcheck

    if (window.event) // IE
    {
        keynum = e.keyCode;
    }
    else if (e.which) // Netscape/Firefox/Opera
    {
        keynum = e.which;
    }

    if (keynum == 13)
    {
       var a = document.getElementById("<%=LinkButton1.ClientID%>");
       invokeClick(a);
    }
}

</script>

</head>

<body onkeydown="javascript:presskey(event);" >
<form id="form1" runat="server" defaultbutton="LinkButton1">
<div class="wrappera">
	<div class="wrapperb">
		<!-- 界面头部 S -->
		<div id="head" class="head">
			<!-- 界面头部 网站LOGO S -->
			<div id="site_logo">
			</div>
			<!-- 界面头部 网站LOGO E -->
			<div id="site_signal">Action Management</div>
			<!-- 界面头部 网站导航栏 S -->
			<div class="site_nav">
				<ul>
					<li class="nowPaged"><a href="Default.aspx">HOME</a></li>
					<li><a href="#">ABOUT US</a></li>
					<li><a href="action_List.aspx">ACTIONS</a></li>
					<li class="right"><a href="admin_Login.aspx">LOGIN</a></li>
					<li class="right"><a href="#">CONTACT US</a></li>
					<li class="right"><a href="#">PARTNERS</a></li>
				</ul>
			</div>
			<!-- 界面头部 网站导航栏 E -->
		</div>
		<!-- 界面头部 E -->

		<!-- 界面主体部分 S -->
		<div class="mainBody">
			<div class="login_Box">
				<img class="login_boxTitle" src="images/login_title.jpg" alt="" />
				<span class="note">Action Management Login...</span>
				<div class="error_message">


<asp:Label ID="Label_errrMessage" runat="server" Text=""></asp:Label>
<asp:Label ID="Label_accountMessage" runat="server" Text=""></asp:Label>
<br>
<asp:Label ID="Label_passwordMessage" runat="server" Text=""></asp:Label>


</div>
				<img class="borderLBCorner" src="images/borderLBCorner.jpg" alt="" />
				<img class="borderRTCorner" src="images/borderRTCorner.jpg" alt="" />
				<img class="borderRBCorner" src="images/borderRBCorner.jpg" alt="" />
				
				<div class="enterInfo" id="divEmail">
					<span id="infoEmail">Account :</span><asp:TextBox ID="tb_Email" 
                        onblur="javascript:checkAccount();"  CssClass="inputA" onkeydown="OnText1Key(event);"
runat="server"></asp:TextBox></div>
				<div class="enterInfo" id="divPwd">
					<span>Password :</span><asp:TextBox ID="tb_Password" 
                        onblur="javascript:checkPassword();" onkeydown="OnText1Key(event);" CssClass="inputA" runat="server" 
                        TextMode="Password"></asp:TextBox></div>
				
				<ul class="validateFiled">
									<li class="validate left">
<asp:TextBox class="inputA" ID="tb_validateCode" onkeydown="OnText1Key(event);" onblur="javascript:checkCode();"   runat="server"></asp:TextBox>
<asp:Label ID="Label_chechCodeMessage" runat="server" Text=""></asp:Label>	
<asp:Label ID="span_info" runat="server" Text="Label">letter are not case-sensitive</asp:Label>										
</li>
									<li class="validateA right"><img id="Image_Validate"  src="Handlers/CheckCodeHandler.ashx?action=getImage" alt="" />
										<a id="refresh" href="javascript:;" onclick="updateCheckCode()">Refresh</a></li>	 
									                                  
                </ul>
                <div class="loginBtn">
<asp:LinkButton ID="LinkButton1" OnClientClick="javascript:validate();"  class="linkE" 
                      runat="server" onclick="LinkButton1_Click1" >Login</asp:LinkButton>
    
                
 
            </div>

			</div>
		</div>
		<!-- 界面主体部分 E -->
		
		<!-- 界面尾部 S -->
		<div id="footer" class="footer">
		</div>
		<!-- 界面尾部 E -->


	</div>
</div>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="tb_Email" Display="None" ErrorMessage="Email Is Necessary"></asp:RequiredFieldValidator>

               <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="tb_Password" Display="None" 
                    ErrorMessage="Password Is Necessary"></asp:RequiredFieldValidator>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                    ErrorMessage="RequiredFieldValidator" 
    ControlToValidate="tb_validateCode" Display="None"></asp:RequiredFieldValidator>
</form>
<input id="Hidden1" value="false" type="hidden" />
</body>

</html>
